<!DOCTYPE html>

<html lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>红袖阁</title>
        <link href="/Novel-Website/css/bootstrap.min.css" rel="stylesheet">
        <link href="/Novel-Website/css/dbcms.css" rel="stylesheet">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <header class="jumbotron subhead ">
            <div class="container">
                <h1 class="text-center" id="title">
                    <!--书名-->
                </h1>
                <p class="lead hidden-phone" id="introduction">
                    <!--简介-->
                </p>
            </div>
        </header>
        <div class="container-fluid">
            <div class="chapterlist">
                <h2 class="text-center">章节目录</h2>
                <div class="row-fluid" id="content">
                   <!--章节目录-->
                </div>
            </div>
        </div>
        <footer class="footer">
            <div class="container">
                <h6>
                    <a href="/Novel-Website/page/主页.html">
                        红袖阁小说网
                    </a>
                </h6>
            </div>
        </footer>
        <script type="text/javascript" src="/Novel-Website/js/jquery-3.3.1.js"></script>
        <script type="text/javascript" src="/Novel-Website/js/common.js"></script>
        <script type="text/javascript">
            window.onload = function () {
                getContent();
                getBook();
            }

            var id = location.search;
            id = id.substring(id.indexOf("=")+1);
            var url = api+"detail/getChapter/"+id;
            function getContent() {
                $.getJSON(url, function (data) {
                    var html =""
                    for (var i = 0; i < data.count; i++) {
                        html = html+ '<div class="span4 item" style="margin-left:0"><a href="/Novel-Website/page/内容.html?id='+data.data[i].id+'" title="'+data.data[i].chapterName +'">'+data.data[i].chapterName+'</a></div>';
                    }
                    document.getElementById("content").innerHTML =html;

                })
            }
            function getBook() {
                $.getJSON(api+"detail/getBook/"+id,function (data) {
                    var bookName = data.data.bookName.split("（",1);
                    var introduction =data.data.introduction.split("　　");
                    var introd ="";
                    for (let i = 0; i < introduction.length; i++) {
                        introd += introduction[i];
                    }
                    $("#title").html('<a>'+bookName+'</a>');
                    $("#introduction").html(introd+'<br><br>')
                })
            }
        </script>
    </body>
</html>